


#include <stdlib.h>
#include <iostream>
#include "subject.h"



std::ostream & operator << ( std::ostream &S, const Subject &subj )
{
    subj.putText(S);
    return S;
}



// Subject ::


    
Subject::Subject( bool truth, Color::eColor col ) :
    m_Color( col ),
    m_bTruth( truth ),
    m_bPendingTruth( truth ),
    m_pPendingExpressions( &m_Expressions )
{
}



/// the door can mutate
bool Subject::mutate()
{
    m_bPendingTruth = !m_bPendingTruth;
    return m_bPendingTruth == m_bTruth;
}



void Subject::restore()
{
    m_bPendingTruth = m_bTruth;
    m_pPendingExpressions = &m_Expressions;
} 



/// add expression to the m_Expressions collection
void Subject::addExpression( Expression *exp )
{
    // argument can be null
    if( exp )
        m_Expressions.push_back( exp );
}
